package foodmaterial.entity;

import java.io.Serializable;

public class JsonResult<T> implements Serializable {

    private static final long serialVersionUID = -6306476312249295782L;

    private Boolean success;
    private String errorMsg;
    private T data;

    public JsonResult() {
    }

    public JsonResult(boolean success, ResultCode resultEnum) {
        this.success = success;
        this.errorMsg = resultEnum.getMessage();
    }

    public JsonResult(boolean success, String msg) {
        this.success = success;
        this.errorMsg = msg;
    }

    public JsonResult(boolean success, ResultCode resultEnum, T data) {
        this.success = success;
        this.errorMsg = resultEnum.getMessage();
        this.data = data;
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
